package day3_4;

public class SellTask implements Runnable {
    int maxCount=300;
    @Override
    public void run() {
        SellTicket();
        if (maxCount<=0) {
            return;
        }

    }
    public synchronized void SellTicket(){
        while (true){
            if (maxCount>0) {
                System.out.println(Thread.currentThread().getName() + "售卖【阿凡达2】票号为" + maxCount);
                maxCount--;
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            }
        }
    }
}
